function [highrange,lowrange,letter]=decodeSeq(letters,possiblef,highd,lowd,binarySum)
    coderange=highd-lowd;
    i=1;
    while(binarySum>=(lowd+coderange*possiblef(i)))
        i=i+1;
    end
    highrange=lowd+coderange*possiblef(i);
    lowrange=lowd;
    if i>1
        lowrange=lowd+coderange*possiblef(i-1);
    end
    letter=letters(i);
end